/******************************************************************************\
*                                                                              *
*     File: devcpp.c                                                           *
*                                                                              *
*   Author: Ron Akkersdijk                                                     *
*  Purpose: A framework for unit testing                                       *
*  Version: 1.0      AKK 20070322                                              *
*           - Initial version                                                  *
*  Version: 1.1      TWI 20080218                                              *
*           - Changed the header file for clear printing                       *
*                                                                              *
\******************************************************************************/
#ifndef    unix    /* assume DEV-CPP */
#include <signal.h>
#include <stdio.h>

/* Dev-Cpp does not have a psignal etc.
 * Let's supply our own version.
 * The one's marked =number= truly exists
 * the other's are just place holders.
 */

const char * sys_siglist[] =
{
   /*   0  */    "no signal",
   /*   1  */    "SIGHUP: Hangup",                     // SIGHUP (POSIX)    modem's etc
   /*  =2= */    "SIGINT: Interrupt",                  // SIGINT (ANSI)    normally ^C
   /*   3  */    "SIGQUIT: Quit",                      // SIGQUIT (POSIX)    normally ^|
   /*  =4= */    "SIGILL: Illegal instruction",        // SIGILL (ANSI)
   /*   5  */    "SIGTRAP: Trace trap",                // SIGTRAP (POSIX)
   /*   6  */    "SIGIO: I/O trap",                    // SIGIO (BSD)
   /*   7  */    "SIGBUS: Bus error",                  // SIGBUS (BSD)
   /*  =8= */    "SIGFPE: Floating point error",       // SIGFPE (ANSI)
   /*   9  */    "SIGKILL: Uncatchable signal",        // SIGKILL (POSIX)
   /*  10  */    "SIGUSR1: User1",                     // SIGUSR1 (POSIX)
   /* =11= */    "SIGSEGV: Segmentation violation",    // SIGSEGV (ANSI)
   /*  12  */    "SIGUSR2: User2",                     // SIGUSR2 (POSIX)
   /*  13  */    "SIGPIPE: Broken pipe",               // SIGPIPE (POSIX)
   /*  14  */    "SIGALRM: Alarm clock",               // SIGALRM
   /* =15= */    "SIGTERM: Termination request",       // SIGTERM
   /*  16  */    "Signal16",
   /*  17  */    "SIGCHLD: Child terminated",          // SIGCHLD (SVID)
   /*  18  */    "SIGCONT: Continue",                  // SIGCONT (POSIX)
   /*  19  */    "SIGSTOP: Stopped",                   // SIGSTOP (POSIX)
   /*  20  */    "SIGTSTP: Stopped",                   // SIGTSTP (POSIX)
   /* =21= */    "SIGBREAK: Control-Break",            // SIGBREAK
   /* =22= */    "SIGABRT: Abnormal termination",       // SIGABRT
       // Dev-Cpp ends here, but just in case ....
   /*  23  */    "Signal23",    //
   /*  24  */    "Signal24",    //
   /*  25  */    "Signal25",    //
   /*  26  */    "Signal26",    //
   /*  27  */    "Signal27",    //
   /*  28  */    "Signal28",    //
   /*  29  */    "Signal29",    //
   /*  30  */    "Signal30",    //
   /*  31  */    "Signal31",    //
   /*  32  */    "Signal32",    //
};

/*
 *   psignal
 */
void    psignal( int sig, const char * mesg )
{
    if ( (0 <= sig) && (sig < NSIG) )
    fprintf(stderr, "%s: %s\n", mesg, sys_siglist[ sig ] );
    else
    fprintf(stderr, "%s: undefined signal %d\n", mesg, sig );
}
#endif
